<template>
	<view class="index-container">
		<van-cell-group class="we-run" v-show="showWeRunDataAuth">
			<van-cell @click="gotoAuth" title="授权获取微信步数" is-link />
		</van-cell-group>
		<view v-show="isReady">
			<view class="date-container">
				<view class="activity-date">{{firstActivityDateText}}</view>
			</view>

			<view class="body-container">
				<!-- 第一列 活动列表-->
				<view class="activity-list">
					<van-image :show-loading="false" @click="gotoActivity(0)" class="activity-list-item" mode="widthFix"
						width="56" height="56" :src="firstActivityLogo" />
					<van-image :show-loading="false" @click="gotoActivity(1)" class="activity-list-item" mode="widthFix"
						width="56" height="56" :src="secActivityLogo" />
					<van-image :show-loading="false" @click="gotoActivity(2)" class="activity-list-item" mode="widthFix"
						width="56" height="56" :src="thirdActivityLogo" />
					<van-image :show-loading="false" @click="gotoActivity(3)" class="activity-list-item" mode="widthFix"
						width="56" height="56" :src="fouthActivityLogo" />
				</view>
				<view class="activity-map">
					<view class="act-addree act-addree-align-end">
						<!-- 地点一 -->
						<view class="act-addree-item" @click="gotoAddress(0)">
							<!-- 已经解锁 -->
							<view v-show="firstActivityDataList[0].isUnLock">
								<van-image :show-loading="false" mode="widthFix" width="70" height="70" round
									:src="firstActivityDataList[0].imgUrl" />
								<view class="act-addree-item-text">{{firstActivityDataList[0].name}}</view>
							</view>
							<!-- 未解锁-不满足解锁条件 -->
							<view v-if="!firstActivityDataList[0].isUnLock && !firstActivityDataList[0].canUnlock">
								<van-image :show-loading="false" mode="widthFix" width="70" height="70" round
									:src="firstActivityDataList[0].lockImgUrl" />
								<view class="act-addree-item-text">{{firstActivityDataList[0].defaultName}}</view>
							</view>

							<!-- 未解锁-满足解锁条件 -->
							<van-image v-if="!firstActivityDataList[0].isUnLock && firstActivityDataList[0].canUnlock"
								:show-loading="false" mode="widthFix" width="70" height="70"
								:src="firstActivityDataList[0].defaultImgUrl" />
							<van-image v-if="!firstActivityDataList[0].isUnLock && firstActivityDataList[0].canUnlock"
								class="loading-gif" :show-loading="false" mode="widthFix" width="70" height="70" round
								:src="gifImgUrl" />
							<view v-if="!firstActivityDataList[0].isUnLock && firstActivityDataList[0].canUnlock"
								class="act-addree-item-text">{{firstActivityDataList[0].defaultName}}</view>
						</view>

						<view class="act-addree-item" @click="gotoAddress(2)">
							<!-- 已经解锁 -->
							<view v-show="firstActivityDataList[2].isUnLock">
								<van-image :show-loading="false" mode="widthFix" width="70" height="70" round
									:src="firstActivityDataList[2].imgUrl" />
								<view class="act-addree-item-text">{{firstActivityDataList[2].name}}</view>
							</view>
							<!-- 未解锁-不满足解锁条件 -->
							<view v-if="!firstActivityDataList[2].isUnLock && !firstActivityDataList[2].canUnlock">
								<van-image :show-loading="false" mode="widthFix" width="70" height="70" round
									:src="firstActivityDataList[2].lockImgUrl" />
								<view class="act-addree-item-text">{{firstActivityDataList[2].defaultName}}</view>
							</view>

							<!-- 未解锁-满足解锁条件 -->
							<van-image v-if="!firstActivityDataList[2].isUnLock && firstActivityDataList[2].canUnlock"
								:show-loading="false" mode="widthFix" width="70" height="70"
								:src="firstActivityDataList[2].defaultImgUrl" />
							<van-image v-if="!firstActivityDataList[2].isUnLock && firstActivityDataList[2].canUnlock"
								class="loading-gif" :show-loading="false" mode="widthFix" width="70" height="70" round
								:src="gifImgUrl" />
							<view v-if="!firstActivityDataList[2].isUnLock && firstActivityDataList[2].canUnlock"
								class="act-addree-item-text">{{firstActivityDataList[2].defaultName}}</view>

						</view>
						<!-- 地点五 -->
						<view style="margin-top:50rpx" class="act-addree-item" @click="gotoAddress(4)">
							<!-- 已经解锁 -->
							<view v-show="firstActivityDataList[4].isUnLock">
								<van-image :show-loading="false" mode="widthFix" width="70" height="70" round
									:src="firstActivityDataList[4].imgUrl" />
								<view class="act-addree-item-text">{{firstActivityDataList[4].name}}</view>
							</view>
							<!-- 未解锁-不满足解锁条件 -->
							<view v-if="!firstActivityDataList[4].isUnLock && !firstActivityDataList[4].canUnlock">
								<van-image :show-loading="false" mode="widthFix" width="70" height="70" round
									:src="firstActivityDataList[4].lockImgUrl" />
								<view class="act-addree-item-text">{{firstActivityDataList[4].defaultName}}</view>
							</view>

							<!-- 未解锁-满足解锁条件 -->
							<van-image v-if="!firstActivityDataList[4].isUnLock && firstActivityDataList[4].canUnlock"
								:show-loading="false" mode="widthFix" width="70" height="70"
								:src="firstActivityDataList[4].defaultImgUrl" />
							<van-image v-if="!firstActivityDataList[4].isUnLock && firstActivityDataList[4].canUnlock"
								class="loading-gif" :show-loading="false" mode="widthFix" width="70" height="70" round
								:src="gifImgUrl" />
							<view v-if="!firstActivityDataList[4].isUnLock && firstActivityDataList[4].canUnlock"
								class="act-addree-item-text">{{firstActivityDataList[4].defaultName}}</view>
						</view>
						<!-- 地点七 -->
						<view class="act-addree-item" @click="gotoAddress(6)">
							<!-- 已经解锁 -->
							<view v-show="firstActivityDataList[6].isUnLock">
								<van-image :show-loading="false" mode="widthFix" width="70" height="70" round
									:src="firstActivityDataList[6].imgUrl" />
								<view class="act-addree-item-text">{{firstActivityDataList[6].name}}</view>
							</view>
							<!-- 未解锁-不满足解锁条件 -->
							<view v-if="!firstActivityDataList[6].isUnLock && !firstActivityDataList[6].canUnlock">
								<van-image :show-loading="false" mode="widthFix" width="70" height="70" round
									:src="firstActivityDataList[6].lockImgUrl" />
								<view class="act-addree-item-text">{{firstActivityDataList[6].defaultName}}</view>
							</view>

							<!-- 未解锁-满足解锁条件 -->
							<van-image v-if="!firstActivityDataList[6].isUnLock && firstActivityDataList[6].canUnlock"
								:show-loading="false" mode="widthFix" width="70" height="70"
								:src="firstActivityDataList[6].defaultImgUrl" />
							<van-image v-if="!firstActivityDataList[6].isUnLock && firstActivityDataList[6].canUnlock"
								class="loading-gif" :show-loading="false" mode="widthFix" width="70" height="70" round
								:src="gifImgUrl" />
							<view v-if="!firstActivityDataList[6].isUnLock && firstActivityDataList[6].canUnlock"
								class="act-addree-item-text">{{firstActivityDataList[6].defaultName}}</view>
						</view>
					</view>
					<view class="act-point">
						<view class="act-point-item1">
							<van-image class="act-point-item1-point" :show-loading="false" mode="widthFix" width="30"
								height="30" src="https://maywork.oss-cn-shanghai.aliyuncs.com/static/point.png" />
							<van-image class="act-point-item1-line" :show-loading="false" mode="widthFix" width="110"
								height="14" src="https://maywork.oss-cn-shanghai.aliyuncs.com/static/line1.png" />
						</view>

						<view class="act-point-item2">
							<van-image class="act-point-item2-point" :show-loading="false" mode="widthFix" width="30"
								height="30" src="https://maywork.oss-cn-shanghai.aliyuncs.com/static/point.png" />
							<van-image class="act-point-item2-line" :show-loading="false" mode="widthFix" width="110"
								height="14" src="https://maywork.oss-cn-shanghai.aliyuncs.com/static/line2.png" />
						</view>

						<view class="act-point-item3">
							<van-image class="act-point-item3-point" :show-loading="false" mode="widthFix" width="30"
								height="30" src="https://maywork.oss-cn-shanghai.aliyuncs.com/static/point.png" />
							<van-image class="act-point-item3-line" :show-loading="false" mode="widthFix" width="90"
								height="14" src="https://maywork.oss-cn-shanghai.aliyuncs.com/static/line3.png" />
						</view>

						<view class="act-point-item4">
							<van-image class="act-point-item4-point" :show-loading="false" mode="widthFix" width="30"
								height="30" src="https://maywork.oss-cn-shanghai.aliyuncs.com/static/point.png" />
							<van-image class="act-point-item4-line" :show-loading="false" mode="widthFix" width="100"
								height="22" src="https://maywork.oss-cn-shanghai.aliyuncs.com/static/line4.png" />
						</view>

						<view class="act-point-item5">
							<van-image class="act-point-item5-point" :show-loading="false" mode="widthFix" width="30"
								height="30" src="https://maywork.oss-cn-shanghai.aliyuncs.com/static/point.png" />
							<van-image class="act-point-item5-line" :show-loading="false" mode="widthFix" width="80"
								height="12" src="https://maywork.oss-cn-shanghai.aliyuncs.com/static/line5.png" />
						</view>

						<view class="act-point-item6">
							<van-image class="act-point-item6-point" :show-loading="false" mode="widthFix" width="30"
								height="30" src="https://maywork.oss-cn-shanghai.aliyuncs.com/static/point.png" />
							<van-image class="act-point-item6-line" :show-loading="false" mode="widthFix" width="98"
								height="20" src="https://maywork.oss-cn-shanghai.aliyuncs.com/static/line6.png" />
						</view>

						<view class="act-point-item7">
							<van-image class="act-point-item7-point" :show-loading="false" mode="widthFix" width="30"
								height="30" src="https://maywork.oss-cn-shanghai.aliyuncs.com/static/point.png" />
							<van-image class="act-point-item7-line" :show-loading="false" mode="widthFix" width="64"
								height="14" src="https://maywork.oss-cn-shanghai.aliyuncs.com/static/line7.png" />
						</view>
					</view>
					<view class="act-addree act-addree-align-start">
						<!-- 地点二 -->
						<view class="act-addree-item" @click="gotoAddress(1)">
							<!-- 已经解锁 -->
							<view v-show="firstActivityDataList[1].isUnLock">
								<van-image :show-loading="false" mode="widthFix" width="70" height="70" round
									:src="firstActivityDataList[1].imgUrl" />
								<view class="act-addree-item-text">{{firstActivityDataList[1].name}}</view>
							</view>
							<!-- 未解锁-不满足解锁条件 -->
							<view v-if="!firstActivityDataList[1].isUnLock && !firstActivityDataList[1].canUnlock">
								<van-image :show-loading="false" mode="widthFix" width="70" height="70" round
									:src="firstActivityDataList[1].lockImgUrl" />
								<view class="act-addree-item-text">{{firstActivityDataList[1].defaultName}}</view>
							</view>

							<!-- 未解锁-满足解锁条件 -->
							<van-image v-if="!firstActivityDataList[1].isUnLock && firstActivityDataList[1].canUnlock"
								:show-loading="false" mode="widthFix" width="70" height="70"
								:src="firstActivityDataList[1].defaultImgUrl" />
							<van-image v-if="!firstActivityDataList[1].isUnLock && firstActivityDataList[1].canUnlock"
								class="loading-gif" :show-loading="false" mode="widthFix" width="70" height="70" round
								:src="gifImgUrl" />
							<view v-if="!firstActivityDataList[1].isUnLock && firstActivityDataList[1].canUnlock"
								class="act-addree-item-text">{{firstActivityDataList[1].defaultName}}</view>
						</view>
						<!-- 地点四 -->
						<view class="act-addree-item" @click="gotoAddress(3)">
							<!-- 已经解锁 -->
							<view v-show="firstActivityDataList[3].isUnLock">
								<van-image :show-loading="false" mode="widthFix" width="70" height="70" round
									:src="firstActivityDataList[3].imgUrl" />
								<view class="act-addree-item-text">{{firstActivityDataList[3].name}}</view>
							</view>
							<!-- 未解锁-不满足解锁条件 -->
							<view v-if="!firstActivityDataList[3].isUnLock && !firstActivityDataList[3].canUnlock">
								<van-image :show-loading="false" mode="widthFix" width="70" height="70" round
									:src="firstActivityDataList[3].lockImgUrl" />
								<view class="act-addree-item-text">{{firstActivityDataList[3].defaultName}}</view>
							</view>

							<!-- 未解锁-满足解锁条件 -->
							<van-image v-if="!firstActivityDataList[3].isUnLock && firstActivityDataList[3].canUnlock"
								:show-loading="false" mode="widthFix" width="70" height="70"
								:src="firstActivityDataList[3].defaultImgUrl" />
							<van-image v-if="!firstActivityDataList[3].isUnLock && firstActivityDataList[3].canUnlock"
								class="loading-gif" :show-loading="false" mode="widthFix" width="70" height="70" round
								:src="gifImgUrl" />
							<view v-if="!firstActivityDataList[3].isUnLock && firstActivityDataList[3].canUnlock"
								class="act-addree-item-text">{{firstActivityDataList[1].defaultName}}</view>
						</view>

						<!-- 地点六 -->
						<view style="margin-top:60rpx;" class="act-addree-item" @click="gotoAddress(5)">
							<!-- 已经解锁 -->
							<view v-show="firstActivityDataList[5].isUnLock">
								<van-image :show-loading="false" mode="widthFix" width="70" height="70" round
									:src="firstActivityDataList[5].imgUrl" />
								<view class="act-addree-item-text">{{firstActivityDataList[5].name}}</view>
							</view>
							<!-- 未解锁-不满足解锁条件 -->
							<view v-if="!firstActivityDataList[5].isUnLock && !firstActivityDataList[5].canUnlock">
								<van-image :show-loading="false" mode="widthFix" width="70" height="70" round
									:src="firstActivityDataList[5].lockImgUrl" />
								<view class="act-addree-item-text">{{firstActivityDataList[5].defaultName}}</view>
							</view>

							<!-- 未解锁-满足解锁条件 -->
							<van-image v-if="!firstActivityDataList[5].isUnLock && firstActivityDataList[5].canUnlock"
								:show-loading="false" mode="widthFix" width="70" height="70"
								:src="firstActivityDataList[5].defaultImgUrl" />
							<van-image v-if="!firstActivityDataList[5].isUnLock && firstActivityDataList[5].canUnlock"
								class="loading-gif" :show-loading="false" mode="widthFix" width="70" height="70" round
								:src="gifImgUrl" />
							<view v-if="!firstActivityDataList[5].isUnLock && firstActivityDataList[5].canUnlock"
								class="act-addree-item-text">{{firstActivityDataList[1].defaultName}}</view>
						</view>
					</view>
				</view>
			</view>
			<view v-if="showRule">
				<RuleModal  @next="next" />
			</view>
			<view class="user-info" >
				<view class="basic-info">
					<van-image class="head-img" width="45" height="45" round :src="runIcon" />
					<view class="user-step">
						<van-button v-show="!isLogin" class="user-login" @click="gotoLogin">点击登录</van-button>
						<!-- <view class="user-login">点击登录</view> -->
						<view class="steps" > 当前步数：{{!isLogin ? '--' : formatNumber() + '步'}}</view>
					</view>
				</view>
				<view class="rule" @click="showRuleModal">
					<van-image class="head-img" width="40" height="40" :src="ruleIcon" />
					<view class="text-info">规则</view>
				</view>
			</view>
		</view>
	</view>
</template>
<script>
	import {
		WXBizDataCrypt
	} from '../../utils/WXBizDataCrypt.ts';
	import config from '../../utils/config.js'
	import RuleModal from "./ruleModal.vue"
	import {
		getUserLevel,
		getWorkChart,
		formatNumber,
		formatDate,
		formatDate1,
		formatDate2,
		questionList,
		videoList,
		gameList,
		getLog
	} from '../../common/activity.js'
	export default {
		components:{RuleModal},
		data() {
			return {
				phone: '',
				showRule: false,
				//游戏列表
				gameList: [],
				//问题列表
				questionList: [],
				//视频列表
				videoList: [],
				//服务器时间
				serverDate: '',
				//获取一是否开启
				firstActivityActive: false,
				secActivityActive: false,
				thirdActivityActive: false,
				fouthActivityActive: false,
				//活动时间
				activityDateList: [],
				runIcon: 'https://maywork.oss-cn-shanghai.aliyuncs.com/static/runIcon.png',
				ruleIcon: 'https://maywork.oss-cn-shanghai.aliyuncs.com/static/rule.png',
				//活动日期
				firstActivityDateText: '',
				//当前活动索引
				currentActivityIndex: 0,
				isReady: false,
				//计数
				count: 0,
				//微信运动定同步定时器
				stepTimer: null,
				//用户信息
				memberInfo: {},
				//是否需要保存微信步数
				isSaveRunDatas: false,
				//微信步数
				stepList: [],
				// 需要用户手动授权微信步数
				showWeRunDataAuth: false,
				//是否登录
				isLogin: false,
				//当前步数
				step: null,
				progress: "",
				img: "",
				nickname: "",
				//关卡解锁数据
				progressList: ["0", "0", "0", "0", "0", "0", "0"],
				//gif 图片地址
				gifImgUrl: 'https://maywork.oss-cn-shanghai.aliyuncs.com/static/unlock.gif',
				// 活动一红途步履数据
				firstActivityDataList: [{
						id: 'step-01',
						// 地点一索引
						index: 0,
						name: '沪西工人半日学校旧址',
						//是否已经解锁
						isUnLock: false,
						//是否可解锁
						canUnlock: false,
						imgUrl: 'https://maywork.oss-cn-shanghai.aliyuncs.com/static/address01.png',
						lockImgUrl: 'https://maywork.oss-cn-shanghai.aliyuncs.com/static/add01-lock.png',
						defaultImgUrl: 'https://maywork.oss-cn-shanghai.aliyuncs.com/static/add01.png',
						detailImgUrl: 'https://maywork.oss-cn-shanghai.aliyuncs.com/static/add01-detail.png',
						defaultName: '地点一',
						//介绍
						intro: '沪西工人半日学校旧址位于上海市普陀区安远路锦绣里（原槟榔路锦绣里178-179号），是中国共产党早期组织于1920年秋创办的全国第一所工人学校。学校由李启汉主持，根据工人日夜轮班制度分早晚两班授课，故称“半日学校”。创办初期，李启汉通过游艺会、留声机音乐和通俗教学（如拆解“工人”为“天”字）吸引工人参与，传播马克思主义和革命思想，启发阶级觉悟。1921年中共一大后，学校更名为“上海第一工人补习学校”，并在邓中夏、瞿秋白等革命者推动下培养出顾正红等工运领袖，成为五卅反帝运动的重要力量。尽管多次遭巡捕房查封，其革命火种催生了沪西工友俱乐部及中共沪西支部，奠定了上海工人运动的基础。1989年，旧址被列为普陀区革命纪念地；2021年修缮后，史料陈列馆正式开放，复原教室场景并展示起义刀剑、信件等珍贵文物，成为红色教育阵地。'
					},
					{	id: 'step-02',
						// 地点二索引
						index: 1,
						name: '顾正红纪念馆',
						//是否已经解锁
						isUnLock: false,
						//是否可解锁
						canUnlock: false,
						imgUrl: 'https://maywork.oss-cn-shanghai.aliyuncs.com/static/address02.png',
						lockImgUrl: 'https://maywork.oss-cn-shanghai.aliyuncs.com/static/add02-lock.png',
						defaultImgUrl: 'https://maywork.oss-cn-shanghai.aliyuncs.com/static/add02.png',
						detailImgUrl: 'https://maywork.oss-cn-shanghai.aliyuncs.com/static/add02-detail.png',
						defaultName: '地点二',
						intro: '顾正红纪念馆位于上海市普陀区澳门路300号，是为纪念中国工人运动先驱顾正红烈士而建，其历史与五卅反帝爱国运动紧密相连。1925年5月15日，顾正红为反抗日本资本家的压迫，带领工人冲入内外棉七厂抗议，遭枪击牺牲，这一事件直接引发了震惊中外的五卅运动。为铭记这段历史，1959年顾正红殉难处首次塑立烈士像和纪念碑，2008年5月30日（五卅运动83周年）纪念馆在原址正式开放。2021年，为庆祝建党百年，纪念馆经扩建改造后重新开放，新增智能化展陈和“五卅运动”专题内容，以耐候钢材质构筑的“红绸”建筑象征工人运动的坚韧与抗争精神。馆内展区通过实物、影像、浮雕等全景展现顾正红生平及五卅运动历程，其殉难处纪念碑由魏文伯题字，五块花岗岩石碑寓意历史浪潮。现为上海市爱国主义教育基地，成为传承红色记忆的重要阵地。'
					},
					{
						id: 'step-03',
						// 地点三索引
						index: 2,
						name: '三山会馆',
						//是否已经解锁
						isUnLock: false,
						//是否可解锁
						canUnlock: false,
						imgUrl: 'https://maywork.oss-cn-shanghai.aliyuncs.com/static/address03.png',
						lockImgUrl: 'https://maywork.oss-cn-shanghai.aliyuncs.com/static/add03-lock.png',
						defaultImgUrl: 'https://maywork.oss-cn-shanghai.aliyuncs.com/static/add03.png',
						detailImgUrl: 'https://maywork.oss-cn-shanghai.aliyuncs.com/static/add03-detail.png',
						defaultName: '地点三',
						intro: '上海三山会馆始建于清宣统元年（1909年），由旅沪福建水果业商人集资兴建，因福州旧称“三山”而得名，是沪上唯一保存完好的晚清会馆建筑。其建筑融合闽南风格，红砖清水墙、雕花门楼与古戏台藻井等工艺精湛，大殿原供奉妈祖神像，兼具商业议事与宗教祭祀功能。1927年3月，上海工人第三次武装起义期间，三山会馆成为工人纠察队南市总部，周恩来曾亲临指导，并在起义胜利后举行成立大会；同年“四一二”政变中，纠察队在此与反动势力殊死抗争，大部分壮烈牺牲，使其成为上海工人运动的重要见证地。1986年因南浦大桥建设，会馆整体南移30米得以保存，1989年修复后免费开放。2010年增建现代风格的新馆，增设上海会馆史陈列馆，展示会馆与城市发展的关联。2021年，馆内“上海工人三次武装起义”展陈改造升级，以沉浸式场景再现党史与工运历程。现为上海市文物保护单位、爱国主义教育基地及全国职工爱国主义教育基地，兼具历史遗址与红色教育功能。'
					},
					{
						id: 'step-04',
						// 地点四索引
						index: 3,
						name: '沪西工友俱乐部旧址',
						//是否已经解锁
						isUnLock: false,
						//是否可解锁
						canUnlock: false,
						imgUrl: 'https://maywork.oss-cn-shanghai.aliyuncs.com/static/address04.png',
						lockImgUrl: 'https://maywork.oss-cn-shanghai.aliyuncs.com/static/add04-lock.png',
						defaultImgUrl: 'https://maywork.oss-cn-shanghai.aliyuncs.com/static/add04.png',
						detailImgUrl: 'https://maywork.oss-cn-shanghai.aliyuncs.com/static/add04-detail.png',
						defaultName: '地点四',
						intro: '沪西工友俱乐部旧址位于今上海市普陀区西康路与安远路交汇处（原德昌里278-280号），是中国共产党早期领导工人运动的重要据点。1924年9月1日，邓中夏、项英、李立三等工运领袖在此创办俱乐部，以“联络感情，交换知识，互相扶助，共谋幸福”为宗旨，通过识字班、讲座等形式传播马克思主义，团结沪西日商纱厂工人。其前身可追溯至1920年李启汉创办的沪西工人半日学校，后经嵇直、孙良惠等人发展为工人补习学校，最终整合为工运核心组织。俱乐部成立仅三个月，便吸纳近千名会员，并在19家纱厂建立秘密工会小组，成为领导1925年“二月罢工”和五卅反帝运动的策源地。1925年初因租界镇压迁至潭子湾三德里，继续组织工人抗争。尽管原址建筑在20世纪50年代部分拆除，仅存南侧一间平房，但其历史地位备受重视，1987年被列为上海市革命纪念地，2014年升格为文物保护单位。如今旧址处设有纪念铭牌和二维码导览，周边社区仍承载着红色记忆，成为党史教育与“四史”学习的重要地标。'
					},
					{
						id: 'step-05',
						// 地点五索引
						index: 4,
						name: '刘华烈士纪念广场',
						//是否已经解锁
						isUnLock: false,
						//是否可解锁
						canUnlock: false,
						imgUrl: 'https://maywork.oss-cn-shanghai.aliyuncs.com/static/address05.png',
						lockImgUrl: 'https://maywork.oss-cn-shanghai.aliyuncs.com/static/add05-lock.png',
						defaultImgUrl: 'https://maywork.oss-cn-shanghai.aliyuncs.com/static/add05.png',
						detailImgUrl: 'https://maywork.oss-cn-shanghai.aliyuncs.com/static/add05-detail.png',
						defaultName: '地点五',
						intro: '刘华烈士纪念广场的历史故事与上海工人运动及五卅反帝斗争紧密相连。其核心纪念地包括位于上海市普陀区武宁路225号沪西工人文化宫内的刘华烈士纪念塑像。该塑像于1992年3月落成，正面为刘华半身铜像，背景假山上镶嵌的大理石镌刻其生平事迹，展现了这位工人领袖的英勇形象。刘华（1899—1925）是五卅运动的重要领导者，1924年任沪西工友俱乐部副主任，组织日商纱厂工人罢工并领导反帝斗争，1925年因叛徒出卖被捕牺牲。其纪念广场不仅承载着上海工人抗争的记忆，也见证了红色精神的传承。此外，刘华家乡四川省宜宾市叙州区烈士陵园亦设有其墓地与事迹陈列，成为当地缅怀英烈的重要场所。上海与四川两地的纪念空间共同构筑了刘华“国而忘家，公而忘私”的革命精神图景。'
					},
					{
						id: 'step-06',
						// 地点六索引
						index: 5,
						name: '上海机器工会成立大会旧址',
						//是否已经解锁
						isUnLock: false,
						//是否可解锁
						canUnlock: false,
						imgUrl: 'https://maywork.oss-cn-shanghai.aliyuncs.com/static/address06.png',
						lockImgUrl: 'https://maywork.oss-cn-shanghai.aliyuncs.com/static/add06-lock.png',
						defaultImgUrl: 'https://maywork.oss-cn-shanghai.aliyuncs.com/static/add06.png',
						detailImgUrl: 'https://maywork.oss-cn-shanghai.aliyuncs.com/static/add06-detail.png',
						defaultName: '地点六',
						intro: '上海机器工会成立大会旧址位于今上海市黄浦区凤阳路186号（原白克路207号上海公学），是中国共产党早期领导工人运动的重要历史地标。1920年11月21日，中国共产党发起组在此召开上海机器工会成立大会，近千名会员、工人代表及社会各界人士参与，孙中山、陈独秀等发表演讲，盛况空前。该工会是中国第一个由马克思主义者领导的工人组织，以“谋会员利益，除会员痛苦”为宗旨，明确提出“五不”原则，与旧式工会划清界限，标志着中共领导工人运动从宣传教育转向组织实践，为中共一大召开奠定阶级基础。原建筑为回字形砖木结构，曾为上海公学校舍，现为黄浦区教育考试中心，基本保留历史风貌，外立面设有“上海机器工会成立大会旧址”纪念铭牌，并建有红色工运陈列室。2021年，为庆祝建党百年，相关部门在旧址附近太平湖绿地设立青铜纪念雕塑，再现知识分子与工人联合的革命场景，强化其作为爱国主义教育基地的价值。'
					},
					{
						id: 'step-07',
						// 地点七索引
						index: 6,
						name: '上海总工会旧址（湖州会馆）',
						//是否已经解锁
						isUnLock: false,
						//是否可解锁
						canUnlock: false,
						imgUrl: 'https://maywork.oss-cn-shanghai.aliyuncs.com/static/address07.png',
						lockImgUrl: 'https://maywork.oss-cn-shanghai.aliyuncs.com/static/add07-lock.png',
						defaultImgUrl: 'https://maywork.oss-cn-shanghai.aliyuncs.com/static/add07.png',
						detailImgUrl: 'https://maywork.oss-cn-shanghai.aliyuncs.com/static/add07-detail.png',
						defaultName: '地点七',
						intro: '上海总工会旧址（湖州会馆）是上海工人运动的重要历史见证。该会馆始建于1910年，由浙江湖州籍商人沈联芳、周庆云等集资兴建，原为同乡联谊场所，占地约20亩，建筑融合江南园林与石库门风格。其历史转折点发生于1927年3月，上海工人第三次武装起义胜利后，工人纠察队攻克被军阀占据的湖州会馆，上海总工会随即迁入并公开办公，周恩来、赵世炎等在此领导工人运动，发布《告世界工人书》等重要文件，并选举成立上海特别市临时市政府，成为大革命时期工人运动的指挥中心。然而，原建筑在1932年“一·二八”淞沪抗战中遭日军炮火炸毁。1996年，原址附近复建部分会馆建筑，2020年经静安区总工会与宝山路街道修缮布展，新增12幅铜版画及沉浸式情景党课，复原了“上海总工会”牌匾及历史场景，并于2021年正式开放。如今，这座仅存140平方米的徽派风格小楼不仅是上海市文物保护单位，更作为党群活动中心，兼具红色教育、职工服务等功能，通过史料展陈与互动体验传承工运精神。'
					}
				],
			}
		},
		computed: {
			showLoginBtn(){
				return this.phone === ''
			},
			firstActivityLogo() {
				return 'https://maywork.oss-cn-shanghai.aliyuncs.com/static/htbl.png'
				// return this.firstActivityActive ? 'https://maywork.oss-cn-shanghai.aliyuncs.com/static/htbl.png' :
				// 	'https://maywork.oss-cn-shanghai.aliyuncs.com/static/htbl-gray.png'
			},
			secActivityLogo() {
				console.log("secActivityLogo===================",this.secActivityActive)
				if (!this.secActivityActive) {
					return 'https://maywork.oss-cn-shanghai.aliyuncs.com/static/gxst-gray.png'
				} else {
					//判断用户是否参参与过  'https://maywork.oss-cn-shanghai.aliyuncs.com/static/gxst-active.png'
					const serverDate = uni.getStorageSync("serverDate") || formatDate1(new Date().getTime())
					// console.log("当前问题列表：",this.questionList)
					const list = this.questionList.filter(question => question.date === serverDate && question.isUnLock === true && question.isAnswer === false)
					console.log("list====",list)
					if(list && list.length > 0){
						console.log(888888,this.questionList)
						return 'https://maywork.oss-cn-shanghai.aliyuncs.com/static/gxst-active.png'
					}else{
						console.log(999999,this.questionList)
						return 'https://maywork.oss-cn-shanghai.aliyuncs.com/static/gxst.png'
					}
				}
			},
			thirdActivityLogo() {
				if (!this.thirdActivityActive) {
					return 'https://maywork.oss-cn-shanghai.aliyuncs.com/static/gyzh-gray.png'
				} else {
					//判断用户是否参参与过  'https://maywork.oss-cn-shanghai.aliyuncs.com/static/gxst-active.png'
					const serverDate = uni.getStorageSync("serverDate") || formatDate1(new Date().getTime())
					const list = this.videoList.filter(video => video.date === serverDate && video.isUnLock === true && video.isPlay === false)
					if(list && list.length > 0){
						return 'https://maywork.oss-cn-shanghai.aliyuncs.com/static/gyzh-active.png'
					}else{
						return 'https://maywork.oss-cn-shanghai.aliyuncs.com/static/gyzh.png'
					}
				}

			},
			fouthActivityLogo() {
				if (!this.fouthActivityActive) {
					return 'https://maywork.oss-cn-shanghai.aliyuncs.com/static/tyxh-gray.png'
				} else {
					const serverDate = uni.getStorageSync("serverDate") || formatDate1(new Date().getTime())
					const list = this.gameList.filter(game => game.date === serverDate && game.isUnLock === true && game.isPlay === false)
					if(list && list.length > 0){
						return 'https://maywork.oss-cn-shanghai.aliyuncs.com/static/tyxh-active.png'
					}else{
						return 'https://maywork.oss-cn-shanghai.aliyuncs.com/static/tyxh.png'
					}
				}
			},

		},
		onHide() {
			// console.log("销毁微信步数同步任务===============>")
			this.stopTimer()
			
		},
		async onLoad() {

		},
		onShow() {
			// this.secActivityActive = null
			// this.thirdActivityActive = null
			// this.fouthActivityActive = null
			const serverDate = uni.getStorageSync("serverDate")
			let frontDate = formatDate1(new Date().getTime())
			//测试
			// frontDate = '2025-06-12'
			if(!serverDate || (serverDate && frontDate != serverDate)){
				uni.setStorageSync("serverDate",frontDate)
			}
			this.currentActivityIndex = 0
			this.loadData()
			//启动微信步数同步定时器
			this.stepTimer = setInterval(() => {
				this.executeStepTask();
			}, 100000);
		},
		methods: {
			//获取手机号
			async gotoLogin() {
				uni.navigateTo({
					url: '/pages/login/index'
				})
			},
			//登录
			async submitLogin() {
				// if(!this.preLoginCheck()){
				// 	return
				// }
				let memberInfo = uni.getStorageSync("memberInfo") || {}
				// memberInfo.nickname = this.nickname
				// memberInfo.img = this.img
				if (this.phone) {
					memberInfo.phone = this.phone
					// 用户信息保存
					await this.$request({
						method: "POST",
						header: {
							"Content-Type": "application/json"
						},
						data: {
							...memberInfo
						},
						url: '/wx/add'
					})
					//设置会话信息
					uni.setStorageSync("memberInfo", memberInfo)
				}
				uni.setStorageSync("isLogin", true)
			},
			showRuleModal(){
				this.showRule = true
			},
			next(){
				this.showRule = !this.showRule
			},
			checkSecActivity(questionDataList){
				for (let dbQuestion of questionDataList) {
					for (let question of questionList) {
						if (dbQuestion.dataid === question.id) {
							question.isAnswer = true
							question.userAnswer = dbQuestion.answer
							uni.setStorageSync(question.id + "_" + question.date, true)
						}
					}
				}
				this.questionList = questionList
				// console.log("问题列表：", this.questionList)
			},
			//检查光影铸魂视频
			checkThirdActivity(videoDataList) {
				for (let dbVideo of videoDataList) {
					for (let video of videoList) {
						if (dbVideo.dataid === video.id) {
							video.isPlay = true
							uni.setStorageSync("video_" + video.date, true)
						}
					}
				}
				this.videoList = videoList
				// console.log("视频列表========：", videoList)
			},
			//检查图绎星火
			checkFouthActivity(gameDataList) {
				for (let dbGame of gameDataList) {
					for (let game of gameList) {
						if (dbGame.dataid === game.id) {
							game.isPlay = true
							game.result = dbGame.answer
						}
					}
				}
				this.gameList = gameList
				// console.log("游戏列表：", this.gameList)
			},
			//跳转地标
			gotoAddress(index) {
				// if (!this.firstActivityActive) {
				// 	uni.showModal({
				// 		title: '温馨提示', //标题
				// 		content: '活动未开启，敬请期待', //提示内容
				// 		showCancel: false //不显示取消按钮
				// 	})
				// 	return
				// }
				if(!this.checkPhone()){
					return 
				}
				const firstActivityDataList = uni.getStorageSync("firstActivityDataList")
				const currentAddress = firstActivityDataList[index]
				const isUnLock = currentAddress.isUnLock
				if (!currentAddress.isUnLock && !currentAddress.canUnlock) {
					uni.showModal({
						title: '温馨提示', //标题
						content: '当前步数未达解锁条件', //提示内容
						showCancel: false //不显示取消按钮
					})
					return
				} else {
					currentAddress.isUnLock = true
					currentAddress.canUnlock = true
				}
				uni.setStorageSync("firstActivityDataList", firstActivityDataList)
				uni.setStorageSync("currentAddress", currentAddress)
				
				if(!isUnLock){
					//保存记录
					const memberInfo = uni.getStorageSync("memberInfo") || {}
					this.$request({
						method: "POST",
						header: {
							"Content-Type": "application/json"
						},
						data: {
							openid: memberInfo.userToken,
							dataid: currentAddress.id,
							answer: '1',
							type: "4"
						},
						url: '/wx/addLog'
					})
				}
				
				
				uni.navigateTo({
					url: '/pages/index/detail'
				})

			},
			// 跳转活动链接
			gotoActivity(index) {
				
				if (index === 0) {
					if (this.currentActivityIndex === index) return
					// if (!this.firstActivityActive) {
					// 	uni.showModal({
					// 		title: '温馨提示', //标题
					// 		content: '活动未开启，敬请期待', //提示内容
					// 		showCancel: false //不显示取消按钮
					// 	})
					// 	return
					// }
					console.log("红途步履")
					uni.navigateTo({
						url: '/pages/index/index'
					})
				} else if (index === 1) {
					if (!this.secActivityActive) {
						uni.showModal({
							title: '温馨提示', //标题
							content: '活动未开启，敬请期待', //提示内容
							showCancel: false //不显示取消按钮
						})
						return
					}
					const serverDate = uni.getStorageSync("serverDate") || formatDate1(new Date().getTime())
					if(serverDate > config.activityDateList[index].endDate){
						uni.showModal({
							title: '温馨提示', //标题
							content: '活动已结束', //提示内容
							showCancel: false //不显示取消按钮
						})
						return
					}
					if(!this.checkPhone()){
						return 
					}
					console.log("工学识途")
					uni.navigateTo({
						url: '/pages/games/answer/index'
					})
				} else if (index === 2) {
					if (!this.thirdActivityActive) {
						uni.showModal({
							title: '温馨提示', //标题
							content: '活动未开启，敬请期待', //提示内容
							showCancel: false //不显示取消按钮
						})
						return
					}
					if(!this.checkPhone()){
						return 
					}
					console.log("光影铸魂")
					uni.navigateTo({
						url: '/pages/games/video/index'
					})
				} else {
					if (!this.fouthActivityActive) {
						uni.showModal({
							title: '温馨提示', //标题
							content: '活动未开启，敬请期待', //提示内容
							showCancel: false //不显示取消按钮
						})
						return
					}
					const serverDate = uni.getStorageSync("serverDate") || formatDate1(new Date().getTime())
					if(serverDate > config.activityDateList[index].endDate){
						uni.showModal({
							title: '温馨提示', //标题
							content: '活动已结束', //提示内容
							showCancel: false //不显示取消按钮
						})
						return
					}
					if(!this.checkPhone()){
						return 
					}
					console.log("图绎星火")
					
					uni.navigateTo({
						url: "/pages/games/idiom/game/game?index=5"
					})
				}

				this.currentActivityIndex = index
			},
			checkPhone(){
				const memberInfo = uni.getStorageSync("memberInfo") || {}
				if(!memberInfo.phone){
					uni.showModal({
						title: '温馨提示', //标题
						content: '请先登录', //提示内容
						showCancel: false //不显示取消按钮
					})
					return false
				}
				return true
			},
			gotoGama() {
				console.log("玩游戏")
				uni.navigateTo({
					url: '/pages/games/idiom/index'
				})
			},
			async loadData() {
				// 活动开启检查
				// this.checkActivityActive()
				this.isLogin = uni.getStorageSync('isLogin') || false
				if (!this.isLogin) {
					await this.getUserInfoByCode();
					if (!this.isLogin) {
						// uni.navigateTo({
						// 	url: '/pages/login/index'
						// })
						// return
					} else {
						if (this.showWeRunDataAuth) {
							return
						}
						this.getAndSetWeRunData()
					}
				} else {
					if (this.showWeRunDataAuth) {
						return
					}
					this.getAndSetWeRunData()
				}


				// console.log("开始啦================")
				const memberInfo = uni.getStorageSync('memberInfo')
			
				
				const serverDate = uni.getStorageSync("serverDate") || formatDate1(new Date().getTime())
				
				//活动二是否开启判断
				for(let question of questionList){
					if (question.date <= serverDate) {
						question.isUnLock = true
					} else {
						question.isUnLock = false
					}
					question.userAnswer = ''
					question.isAnswer = false
				}
				
				//活动三是否开启判断
				for(let video of videoList){
					if (video.date <= serverDate) {
						video.isUnLock = true
					} else {
						video.isUnLock = false
					}
					video.isPlay = false
				}
				
				//活动四是否开启判断
				for(let game of gameList){
					if (game.date <= serverDate) {
						game.isUnLock = true
					} else {
						game.isUnLock = false
					}
					game.isPlay = false
					game.result = ''
				}

				//获取用户参与记录
				await getLog().then(res => {
					// console.log(res.data, "log")
					const dataList = res.data
					if (dataList && dataList.length > 0) {
						//活动一状态检查
						let stepDataList = dataList.filter(item => item.type === '4')
						// console.log("db活动一：",stepDataList)
						// console.log("前端活动一：",this.firstActivityDataList)
						if (stepDataList) {
							for(let dbStepData of stepDataList){
								for(let stepData of this.firstActivityDataList){
									if(dbStepData.dataid === stepData.id){
										//已经解锁
										stepData.isUnLock = true
										stepData.canUnlock = true
									}
								}
							}
							// console.log("活动一=========",this.firstActivityDataList)
							uni.setStorageSync("firstActivityDataList",this.firstActivityDataList)
						}
						
						//检查活动二
						let questionDataList = dataList.filter(item => item.type === '1')
						// console.log("活动二列表：",questionDataList)
						if (questionDataList) {
							this.checkSecActivity(questionDataList)
						}else{
							this.questionList = questionDataList
						}
						
						//检查活动三
						let videoDataList = dataList.filter(item => item.type === '2')
						if (videoDataList) {
							this.checkThirdActivity(videoDataList)
						}else{
							this.videoList = videoList
						}
						//检查活动四
						let gameDataList = dataList.filter(item => item.type === '3')
						if (gameDataList) {
							this.checkFouthActivity(gameDataList)
						}else{
							this.gameList = gameList
						}
					}else{
						this.questionList = questionList
						this.videoList = videoList
						this.gameList = gameList
					}
					// console.log("保存来了======================》")
					uni.setStorageSync("questionList",questionList)
					uni.setStorageSync("gameList",gameList)
				})

				//获取用户总步数和关卡
				getUserLevel().then(res => {
					// console.log("用户关卡数据：", res)
					this.step = res.data.step
					this.progress = res.data.progress
					let firstActivityDataList = uni.getStorageSync("firstActivityDataList") || this
						.firstActivityDataList;
					//关卡解锁
					if (this.progress != "0") {
						const progress = parseInt(this.progress)
						for (let i = 0; i < this.firstActivityDataList.length; i++) {
							let firstActivityData = firstActivityDataList[i]
							const progress = parseInt(this.progress)
							if (firstActivityData.index + 1 <= progress) {
								if (!firstActivityData.isUnLock && !firstActivityData.canUnlock) {
									//可以解锁
									firstActivityData.canUnlock = true
								}
							} else {
								firstActivityData.isUnLock = false
								firstActivityData.canUnlock = false
							}
						}
					}
					this.firstActivityDataList = firstActivityDataList
					uni.setStorageSync("firstActivityDataList", firstActivityDataList)
					// console.log("解锁关卡信息：", this.firstActivityDataList)

					// 活动开启检查
					this.checkActivityActive()

					this.isReady = true
				});
			},
			// 判断活动是否开启
			checkActivityActive() {
				console.log("判断活动是否开启=================")
				let serverDate = uni.getStorageSync("serverDate")
				if (!serverDate) {
					serverDate = formatDate1(new Date().getTime())
					// console.log("前端日期", serverDate)
				}
				console.log("serverDate ===",serverDate)
				this.activityDateList = config.activityDateList;
				this.firstActivityDateText = formatDate2(config.activityDateList[0].startDate) + ' - ' + formatDate2(config
					.activityDateList[0].endDate)
				if (serverDate >= this.activityDateList[0].startDate) {
					this.firstActivityActive = true
				}else{
					this.firstActivityActive = false
				}
				if (serverDate >= this.activityDateList[1].startDate) {
					this.secActivityActive = true
				}else{
					this.secActivityActive = false
				}
				if (serverDate >= this.activityDateList[2].startDate) {
					this.thirdActivityActive = true
				}else{
					this.thirdActivityActive = false
				}
				if (serverDate >= this.activityDateList[3].startDate) {
					this.fouthActivityActive = true
				}else{
					this.fouthActivityActive = false
				}
			},
			//步数排行榜
			getWorkChart() {
				getWorkChart().then((res) => {
					console.log("步数排行榜数据：", res)
				})
			},
			executeStepTask() {
				console.log('同步微信步数任务执行===========');
				if (this.count === 20) {
					this.stopTimer()
				}
				this.loadData()
				this.count++
			},
			// 任务停止
			stopTimer() {
				if (this.stepTimer) {
					clearInterval(this.stepTimer);
					this.stepTimer = null; // 清除引用，避免重复清除导致的错误
				}
			},
			//格式化步数
			formatNumber() {
				if (this.step != null) {
					return formatNumber(this.step, 1)
				}
			},
			// 获取并保存微信运动数据
			async getAndSetWeRunData() {
				const weRunData = await this.getWeRunData()
				if (weRunData.errMsg == 'getWeRunData:fail auth deny') {
					console.log("需要用户手动打开授权")
					this.showWeRunDataAuth = true
				} else {
					//保存微信运动数据
					// if (this.firstActivityActive) {
						this.saveWeRunData()
					// }
				}
			},
			checkSession() {
				return new Promise((resolve, reject) => {
					uni.checkSession({
						success: async (res) => {
							console.log("检查session 成功", res)
							resolve(res)
						},
						fail: async (err) => {
							console.log("检查session 失败", err)
							await this.getUserInfoByCode()
							resolve({
								errMsg: "checkSession:ok"
							})
						}
					})
				})
			},
			gotoAuth() {
				console.log("手动打开微信运动授权")
				this.weRunAuthorize().then(async (res) => {
					if (res.errMsg == "getWeRunData:fail auth deny") {
						// 用户拒绝授权
						this.showWeRunDataAuth = true
					} else {
						this.showWeRunDataAuth = false
						//获取微信运动数据
						this.getAndSetWeRunData()
					}
				}).catch(err => {
					console.log("err")
					this.showWeRunDataAuth = true
				})
			},
			//微信运动授权
			weRunAuthorize() {
				return new Promise((resolve, reject) => {
					wx.authorize({
						scope: 'scope.werun',
						success: (res) => {
							// 用户已同意授权，可以调用运动数据相关API
							console.log('用户同意授权运动数据');
							resolve({
								authSetting: {
									'scope.werun': true
								}
							})
						},
						fail: (err) => {
							// 用户拒绝授权，可以引导用户手动开启
							console.log("用户拒绝授权微信运动步数", err)
							wx.showModal({
								title: '授权设置',
								content: '您还未开启步数授权，无法获取步数信息，请点击当前右上角-设置-允许使用【微信运动步数】',
								success: (res) => {
									if (res.confirm) {
										wx.openSetting({
											success: (res) => {
												console.log('授权返回数据',
													res);
												if (res.authSetting[
														'scope.werun']) {
													// 用户已经授权
													console.log('用户已授权');
													resolve(res)
												} else {
													// 用户未授权
													console.log('用户未授权');
													reject(res)
												}

											},
											fail: (err) => {
												console.log('授权失败', err);
												reject(err)
											}
										});
									} else {
										console.log('授权失败', res);
										reject(res.cancel)
									}
								},
								fail: (err) => {
									console.log('授权失败', err);
									reject(err)
								}
							});
						}
					})
				})

			},
			//根据code 获取用户信息
			getUserInfoByCode() {
				return new Promise((resolve, reject) => {
					uni.login({
						provider: 'weixin',
						success: async (res) => {
							const userData = await this.$request({
								method: "POST",
								header: {
									"Content-Type": "application/json"
								},
								data: {
									"jsCode": res.code
								},
								url: '/wx/getOpenInfo'
							})
							let memberInfo = uni.getStorageSync("memberInfo") || {};
							Object.assign(memberInfo, userData.data)
							if (!memberInfo.phone) {
								//需要登录
								uni.setStorageSync("isLogin", false)
								this.isLogin = false
							} else {
								uni.setStorageSync("isLogin", true)
								this.isLogin = true
							}
							this.phone = memberInfo.phone || ''
							uni.setStorageSync("memberInfo", memberInfo);
							resolve(memberInfo)
						},
						fail: reject
					})
				})
			},
			//保存微信运动数据
			async saveWeRunData() {
				console.log("保存微信运动数据开始======>",this.isSaveRunDatas)
				const memberInfo = uni.getStorageSync("memberInfo")
				//保存用户运动数据
				if (this.isSaveRunDatas) {
					let steps = [];
					let lastFiveStepList = this.stepList.slice(-5);
					// 保存用户运动步数
					this.$request({
						method: "POST",
						header: {
							"Content-Type": "application/json"
						},
						data: {
							openid: memberInfo.userToken,
							list: lastFiveStepList
						},
						url: '/wx/step'
					})
				}
			},
			//获取微信运动步数
			async getWeRunData() {
				// 会话检查
				await this.checkSession()
				return new Promise((resolve, reject) => {
					//缓存中当前步数
					const hisSteps = uni.getStorageSync("currentSteps")
					const appId = config.appId
					wx.getWeRunData({
						success: async (res) => {
							let decryptedData
							try {
								const {
									sessionKey
								} = uni.getStorageSync("memberInfo")
								const wxBizDataCrypt = new WXBizDataCrypt(appId,
									sessionKey);
								decryptedData = wxBizDataCrypt.decryptData(
									res
									.encryptedData, res.iv);
								// console.log("解密后运动数据：", decryptedData)
								const watermark = decryptedData.watermark
								const serverDate = uni.getStorageSync("serverDate") || formatDate1(new Date().getTime())
								let wechatServerDate = formatDate(watermark.timestamp) 
								//测试
								// wechatServerDate = '2025-05-09'
								// console.log("wechatServerDate =====",wechatServerDate)
								if (wechatServerDate) {
									// uni.setStorageSync("serverDate", wechatServerDate)
								}else{
									wechatServerDate = serverDate
								}
								this.serverDate = wechatServerDate
							} catch (error) {
								console.log("解密异常：", error)
								await this.getUserInfoByCode()

								const {
									sessionKey
								} = uni.getStorageSync("memberInfo")
								const wxBizDataCrypt = new WXBizDataCrypt(appId,
									sessionKey);
								decryptedData = wxBizDataCrypt.decryptData(
									res
									.encryptedData, res.iv);
								console.log("解密后运动数据：", decryptedData)
								const watermark = decryptedData.watermark
								const serverDate = uni.getStorageSync("serverDate")
								const wechatServerDate = formatDate(watermark.timestamp)
								if (wechatServerDate != serverDate) {
									uni.setStorageSync("serverDate", wechatServerDate)
								}
								this.serverDate = wechatServerDate
							}

							const stepInfoList = decryptedData.stepInfoList;
							// 格式化步数
							for (let step of stepInfoList) {
								this.stepList.push({
									"createTime": formatDate(step.timestamp),
									"step": step.step
								})
							}
							//当前最新步数
							const currentSteps = this.stepList[this.stepList.length - 1]
							if (hisSteps && hisSteps.createTime === currentSteps.createTime &&
								hisSteps.step === currentSteps.step) {
								// 当天步数一致不需要保存运动数据
								console.log("不需要保存微信运动")
								this.isSaveRunDatas = false
								//如果当天超过5000步，关闭定时器
								if (hisSteps.step > 5000) {
									console.log("当前步数超过5千，关闭定时同步")
									// 停止同步
									this.stopTimer()
								}
							} else {
								//如果当天超过5000步，关闭定时器
								if (hisSteps && hisSteps.createTime === currentSteps.createTime &&
									hisSteps
									.step > 5000) {
									console.log("当前步数超过5千，关闭定时同步")
									this.isSaveRunDatas = false
									// 停止同步
									this.stopTimer()
								} else {
									//需要保存运动数据
									console.log("需要保存微信运动")
									this.isSaveRunDatas = true
								}
								uni.setStorageSync("currentSteps", currentSteps)
							}
							resolve(this.stepList)
						},
						fail: err => {
							console.log("获取微信运动数据失败：", err)
							this.showWeRunDataAuth = true
							reject(err)
						}
					});
				})
			},
		}
	}
</script>
<style lang='scss'>
	.index-container {
		width: 100%;
		height: 2506rpx;
		background-image: url('https://maywork.oss-cn-shanghai.aliyuncs.com/static/bg521.png');
		background-size: contain;
		background-repeat: no-repeat;
		background-position: center;
		
		.we-run{
			z-index: 999999;
			width: 100%;
			position: fixed;
			left: 0;
			top:0;
			
			.van-cell{
				background: #FFEAEA;
				color: #FF1518;
				font-size:32rpx;
			}
		}

		.date-container {
			display: flex;
			width: 100%;
			justify-content: center;
			align-items: center;

			.activity-date {
				margin-top: 200rpx;
				background: #fff;
				width: 300rpx;
				height: 50rpx;
				line-height: 50rpx;
				text-align: center;
				border-radius: 30rpx;
				color: #FF1518;
				font-size: 28rpx;
			}
		}


		.body-container {
			display: flex;
			height: 1800rpx;

			.activity-list {
				width: 16%;
				/* border: 1px solid red; */
				display: flex;
				flex-direction: column;
				align-items: flex-end;
				padding-top: 640rpx;

				&-item {
					margin-bottom: 40rpx;
				}
			}

			.activity-map {
				width: 84%;
				/* border: 1px solid red; */
				display: flex;

				.loading-gif {
					z-index: 9;
					margin-top: -70px;
					border-radius: 70px;
					/* background-color: rgba(0, 0, 0, 0.5); */
				}

				.act-addree {
					display: flex;
					flex-direction: column;
					width: 32%;
					/* border: 1px solid red; */

					.act-addree-item {
						display: flex;
						flex-direction: column;
						justify-content: center;
						align-items: center;
						text-align: center;
						width: 100%;
						/* border: 1px solid green; */
						margin-bottom: 230rpx;

						&-text {
							color: #FFF0CB;
							font-size: 12px;
							margin-top: 4px;
							width: 90px;
						}
					}
				}

				.act-point {
					width: 36%;
					/* border: 1px solid blue; */
					display: flex;
					flex-direction: column;
					padding-top: 540rpx;
					align-items: center;

					&-item1 {
						width: 100%;
						/* border:2px solid blue; */
						display: flex;
						flex-direction: column;

						&-point {
							margin-left: 180rpx;
							width: 100%;
						}

						&-line {
							/* border:1px solid blue; */
							margin-top: -14rpx;
							/* margin-left: -10rpx; */

						}
					}

					&-item2 {
						margin-top: 116rpx;
						width: 100%;
						display: flex;
						flex-direction: column;

						&-point {
							margin-left: -80rpx;
							width: 100%;
						}

						&-line {
							margin-top: -40rpx;
							margin-left: -48rpx;

						}

					}

					&-item3 {
						margin-top: 160rpx;
						width: 100%;
						display: flex;
						flex-direction: column;

						&-point {
							margin-left: 148rpx;
							width: 100%;
						}

						&-line {
							margin-top: -40rpx;
						}
					}

					&-item4 {
						margin-top: 180rpx;
						width: 100%;
						display: flex;
						flex-direction: column;

						&-point {
							margin-left: -94rpx;
							width: 100%;
						}

						&-line {
							margin-top: -42rpx;
							margin-left: -60rpx;
						}
					}

					&-item5 {
						margin-top: 130rpx;
						width: 100%;
						display: flex;
						flex-direction: column;

						&-point {
							margin-left: 148rpx;
							width: 100%;
						}

						&-line {
							margin-top: -50rpx;
							margin-left: -4rpx;
						}
					}

					&-item6 {
						margin-top: 160rpx;
						width: 100%;
						display: flex;
						flex-direction: column;

						&-point {
							margin-left: -82rpx;
							width: 100%;
						}

						&-line {
							margin-top: -44rpx;
							margin-left: -52rpx;
						}
					}

					&-item7 {
						margin-top: 120rpx;
						width: 100%;
						display: flex;
						flex-direction: column;

						&-point {
							margin-left: 96rpx;
							width: 100%;
						}

						&-line {
							margin-top: -10rpx;
							margin-left: -12rpx;
						}
					}


				}

				.act-addree-align-start {
					padding-top: 700rpx;
					align-items: center;
					margin-left: -70rpx;
				}

				.act-addree-align-end {
					padding-top: 500rpx;
					align-items: center;
				}
			}
		}

		.user-info {
			position: fixed;
			bottom: 70rpx;
			width: 92%;
			background: #FFEAEA;
			/* background-image: linear-gradient(to right, #FFF6F6, #FFEAEA); */
			opacity: 1;
			display: flex;
			align-items: center;
			/* border: 1px solid red; */
			height: 128rpx;
			border-radius: 8px;
			margin-left: 4%;
			/* margin-top: 240rpx; */

			.basic-info {

				/* border: 1px solid red; */
				width: 80%;
				display: flex;
				justify-content: center;
				align-items: center;
		
				.head-img {
					/* border: 1px solid blue; */
					width: 30%;
					text-align: center;
				}

				.user-step {
					display: flex;
					flex-direction: column;
					justify-content: center;
					/* border: 1px solid yellow; */
					width: 70%;
					/* margin-top: 6px; */
					font-size: 12px;
					/* margin-top: 40rpx; */
					.user-login{
						font-family: PingFang SC;
						font-size: 14px;
						font-weight: 600;
						line-height: normal;
						letter-spacing: normal;
						/* vi */
						color: #E9412C;
					}
					
					.van-button{
						height: 70rpx;
						color: #E9412C;
						background: #FFEAEA;
						border: 0;
						padding: 0 !important;
					}
				}
			}

			.rule {
				display: flex;
				justify-content: center;
				align-items: center;
				flex-direction: column;
				width: 20%;
				height: 100%;
			}

			.charts {
				display: flex;
				justify-content: center;
				align-items: center;
				flex-direction: column;
				width: 20%;
				height: 100%;
			}

			.text-info {
				font-size: 12px;
			}
		}
	}
</style>